package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

public interface Usermapper {
    @Select("select * from user where openid=#{openid}")
    User selectByOpenid(String openid);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("INSERT INTO user(openid,name,create_time) values (#{openid},#{name},#{createTime})")
    void insert(User user);

    /**
     * 根据用户id查询用户信息
     * @param id
     * @return
     */

    @Select("select * from user where id = #{id}")
    User selectById(Long id);

    /**
     * 统计用户数
     * @param map
     * @return
     */

    Integer countByMap(Map map);
}
